<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCartsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('carts', function (Blueprint $table) {
          $table->charset = 'utf8';
          $table->collation = 'utf8_general_ci';
          $table->increments('id',11);
          $table->string('commodity_name',255)->comment("商品名称");
          $table->string('commodity_id')->nullable(true)->comment("商品id");
          $table->string('commodity_series_id')->nullable(true)->comment("系列型号id");
          $table->string('commodity_series_title')->nullable(true)->comment("系列型号名称");
          $table->string('img',255)->comment("商品图片");
          $table->string('price',255)->comment("商品价格");
          $table->integer('receiving_address_id',10)->comment("购物车当前商品收货地址id");
          $table->text('leaving_a_message')->comment("给卖家留个言");
          $table->integer('user_id')->nullable(true)->comment("当前商品所属用户");
          $table->integer('is_selected')->default(0)->comment("此商品是否选中");
          $table->integer('num')->default(0)->comment("商品数量");
          $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('carts');
    }
}
